package org.esti.service.impl;

import org.esti.model.Appraisal;
import org.esti.model.dao.AppraisalDAO;
import org.esti.service.AppraisalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author Artem Loginov (logart)
 */

/**
 * {@inheritDoc}
 */
@Service
public class AppraisalServiceImpl implements AppraisalService {

    @Autowired
    private AppraisalDAO dao;

    /**
     * {@inheritDoc}
     */
    @Override
    public Appraisal getAppraisalByLevel(long levelId) {
        return dao.getAppraisalByLevelId(levelId);
    }

    @Override
    public Appraisal createAppraisal(Appraisal appraisal) {
        return dao.add(appraisal);
    }

    @Override
    public List<Appraisal> getAllAppraisals() {
        return dao.getAllAppraisals();
    }

    @Override
    public Appraisal getAppraisalById(long id) {
        return dao.getAppraisalById(id);
    }

    @Override
    public Appraisal updateAppraisal(Appraisal appraisal) {
        return dao.update(appraisal);
    }

    @Override
    public void delete(long id) {
        dao.remove(id);
    }

    @Override
    public List<Appraisal> getAvailableAppraisals() {
        return dao.getAvailableAppraisals();
    }
}
